<?php namespace Phpcmf\Controllers\Member;

class Jiaru extends \Phpcmf\Member\Module
{

	// 会员加入圈子
	public function index() {
	    $qid = (int)\Phpcmf\Service::L('input')->get('qid');
	    // 判断是否购买加入圈子
	    $data = \Phpcmf\Service::M()->db->table('1_quan_buy')->where('cid', $hid)->where('uid', $this->uid)->get()->getRowArray();
	    $data = 1;
	    $rt=[
            'code'=>1,
            'msg'=>2,
            'data'=> $data
            ];
        $this->_json($rt['code'], $rt['msg'], $rt['data']);
		//$this->_Member_List();
	}

	public function fufeijiaquan() {
		$quanid = (int)\Phpcmf\Service::L('input')->get('quanid');
		$quandata = \Phpcmf\Service::M()->db->table('1_quan')->where('id', $quanid)->get()->getRowArray();
		$fufei = \Phpcmf\Service::M()->db->table('1_quan_buy')->where('cid', $quanid)->where('uid', $this->uid)->get()->getRowArray();
		$cart = \Phpcmf\Service::M()->db->table('1_quan_cart')->where('cid', $quanid)->where('uid', $this->uid)->get()->getRowArray();
		if (!$this->uid) {
		    $rt=[
            'msg'=>'还没有登录',
            ];
            return $this->_json(0, 0, $rt);
        } elseif (!$quanid) {
            $rt=[
            'msg'=>'圈子ID为空',
            ];
            return $this->_json(0, 0, $rt);
        } elseif(!$quandata){
            $rt=[
            'msg'=>'没有这个圈子',
            ];
            return $this->_json(0, 0, $rt);
        } elseif($quandata['price']==0){
            $rt=[
            'msg'=>'这个是免费圈子',
            ];
            return $this->_json(0, 0, $rt);
        
        } elseif($fufei) {
            if(!$cart){
                // 加入圈子记录
                \Phpcmf\Service::M()->db->table('1_quan_cart')->insert(array(
            	    'cid' => $quanid,
            	    'uid' => $this->uid,
            	    'read_name' => '',
            	    'read_url' => '',
            		'inputtime' => SYS_TIME,
            	));
                $rt=[
                'code'=>1,
                'msg'=>'您已加入圈子',
                ];
                return $this->_json(0, 0, $rt);
            } elseif($fufei['endtime'] < time()) {
                //续费
                if($this->member['money'] < $quandata['price']){
                    $rt=[
                    'msg'=>'余额不足，请充值。您的余额：'.$this->member['money'].' 元',
                    ];
                    return $this->_json(0, 0, $rt);
                } else {
                    //扣取加入圈子费用
                    \Phpcmf\Service::M('member')->add_money($this->uid, (int)-$quandata['price']);
                    \Phpcmf\Service::M('Pay')->add_paylog([
                        'uid' => $this->uid,
                        'username' => "",
                        'touid' => (int)$quandata['uid'],
                        'tousername' => '',
                        'mid' => 'system', // 特征字符串，system表示系统
                        'title' => '续费 “'.$quandata['title'].'”圈子',
                        'value' => (int)-$quandata['price'], // 交易金额，正数表示增加金额，负数表示消费金额
                        'type' => 'finecms', // 支付方式，alipy，weixin，finecms表示余额
                        'status' => 1, // 1表示交易成功,0表示未成功
                        'result' => '付费 “'.$quandata['title'].'”圈子',
                        'paytime' => SYS_TIME, // 付款时间，默认当前时间
                        'inputtime' => SYS_TIME, // 流水参生时间，默认当前时间
                    ]);
                    //给圈主添加加圈费用
                    \Phpcmf\Service::M('member')->add_money($quandata['uid'], (int)$quandata['price']);
                    \Phpcmf\Service::M('Pay')->add_paylog([
                        'uid' => $quandata['uid'],
                        'username' => "",
                        'touid' => (int)$this->uid,
                        'tousername' => '',
                        'mid' => 'system', // 特征字符串，system表示系统
                        'title' => '续费 “'.$quandata['title'].'”圈子 ',
                        'value' => (int)$quandata['price'], // 交易金额，正数表示增加金额，负数表示消费金额
                        'type' => 'finecms', // 支付方式，alipy，weixin，finecms表示余额
                        'status' => 1, // 1表示交易成功,0表示未成功
                        'result' => '续费 “'.$quandata['title'].'”圈子 ',
                        'paytime' => SYS_TIME, // 付款时间，默认当前时间
                        'inputtime' => SYS_TIME, // 流水参生时间，默认当前时间
                    ]);
                    //通知
                    $dataim = [
                         'catid'=> 8, //类型
                         'title' => '圈子 续费', //标题
                         'zhiding' => '', //置顶
                         'content'=> '续费 “'.$quandata['title'].'”圈子 ', //通知内容
                         'uid'=> $this->uid, //发布人的uid
                         'faxinren'=> $this->uid, //发布人的uid
                         'shouxinren'=> (int)$quandata['uid'],//收信人
                         'tupian'=> '', //图片
                         'shipin'=> '', //视频
                         'yuyin'=> '', //语音
                         'fujian'=> '', //附件
                         'yidu'=> 0, //已读
                         'quanziid'=> $quanid, //圈子ID
                         'quantieid'=> '', //圈帖ID
                         'url' => '',
                        ];
                        \Phpcmf\Service::M('auth')->addtongzhi($dataim);
                        // 续费圈子记录
                        \Phpcmf\Service::M()->db->table('1_quan_buy')->where('cid', $quanid)->where('uid', $this->uid)->update([
                    		'inputtime' => SYS_TIME,
                    		'endtime'=> SYS_TIME + 3600 * 24 * $quandata['tianshu'],
                    	]);
                    	
                    	$rt=[
                    	'code'=>'1',
                        'msg'=>'续费成功',
                        ];
                        $this->_json(1, 2, $rt);
                    }
                //续费结束
                
            } else {
                $rt=[
                'msg'=>'您已付费加入，不需重复付费',
                ];
                return $this->_json(0, 0, $rt);
            }
            
        
        } elseif($cart){
            
        }
        if(!$fufei){
            if($this->member['money'] < $quandata['price']){
                $rt=[
                'msg'=>'余额不足，请充值。您的余额：'.$this->member['money'].' 元',
                ];
                $this->_json(0, 0, $rt);
            } else {
                
                //扣取加入圈子费用
                \Phpcmf\Service::M('member')->add_money($this->uid, (int)-$quandata['price']);
                \Phpcmf\Service::M('Pay')->add_paylog([
                    'uid' => $this->uid,
                    'username' => "",
                    'touid' => (int)$quandata['uid'],
                    'tousername' => '',
                    'mid' => 'system', // 特征字符串，system表示系统
                    'title' => '付费加入“'.$quandata['title'].'”圈子',
                    'value' => (int)-$quandata['price'], // 交易金额，正数表示增加金额，负数表示消费金额
                    'type' => 'finecms', // 支付方式，alipy，weixin，finecms表示余额
                    'status' => 1, // 1表示交易成功,0表示未成功
                    'result' => '付费加入“'.$quandata['title'].'”圈子',
                    'paytime' => SYS_TIME, // 付款时间，默认当前时间
                    'inputtime' => SYS_TIME, // 流水参生时间，默认当前时间
                ]);
                //给圈主添加加圈费用
                \Phpcmf\Service::M('member')->add_money($quandata['uid'], (int)$quandata['price']);
                \Phpcmf\Service::M('Pay')->add_paylog([
                    'uid' => $quandata['uid'],
                    'username' => "",
                    'touid' => (int)$this->uid,
                    'tousername' => '',
                    'mid' => 'system', // 特征字符串，system表示系统
                    'title' => '付费加入“'.$quandata['title'].'”圈子',
                    'value' => (int)$quandata['price'], // 交易金额，正数表示增加金额，负数表示消费金额
                    'type' => 'finecms', // 支付方式，alipy，weixin，finecms表示余额
                    'status' => 1, // 1表示交易成功,0表示未成功
                    'result' => '付费加入“'.$quandata['title'].'”圈子',
                    'paytime' => SYS_TIME, // 付款时间，默认当前时间
                    'inputtime' => SYS_TIME, // 流水参生时间，默认当前时间
                ]);
                //通知
                $dataim = [
                     'catid'=> 8, //类型
                     'title' => '付费加入圈子', //标题
                     'zhiding' => '', //置顶
                     'content'=> '付费加入“'.$quandata['title'].'”圈子', //通知内容
                     'uid'=> $this->uid, //发布人的uid
                     'faxinren'=> $this->uid, //发布人的uid
                     'shouxinren'=> (int)$quandata['uid'],//收信人
                     'tupian'=> '', //图片
                     'shipin'=> '', //视频
                     'yuyin'=> '', //语音
                     'fujian'=> '', //附件
                     'yidu'=> 0, //已读
                     'quanziid'=> $quanid, //圈子ID
                     'quantieid'=> '', //圈帖ID
                     'url' => '',
                    ];
                    \Phpcmf\Service::M('auth')->addtongzhi($dataim);
                // 加入圈子记录
                \Phpcmf\Service::M()->db->table('1_quan_cart')->insert(array(
            	    'cid' => $quanid,
            	    'uid' => $this->uid,
            	    'read_name' => '',
            	    'read_url' => '',
            		'inputtime' => SYS_TIME,
            	));
            	// 购买加入圈子记录
                \Phpcmf\Service::M()->db->table('1_quan_buy')->insert(array(
            	    'cid' => $quanid,
            	    'uid' => $this->uid,
            		'inputtime' => SYS_TIME,
            		'endtime'=> SYS_TIME + 3600 * 24 * $quandata['tianshu']
            	));
            	$rt=[
            	'code'=>'1',
                'msg'=>'加入成功',
                ];
                $this->_json(1, 2, $rt);
            }
        } else {
            $rt=[
            'msg'=>'没有用任何数据。接口错误',
            ];
            $this->_json(0, 2, $rt);
        }
		
	}
	// 会员组介绍
	public function huiyuanzu() {
		$quanid = (int)\Phpcmf\Service::L('input')->get('quanid');
		$huiyuanzuid = (int)\Phpcmf\Service::L('input')->get('huiyuanzuid');
		$huiyuanzudata = \Phpcmf\Service::M()->db->table('1_quan_form_yonghuzu')->where('cid', $quanid)->where('id', $huiyuanzuid)->get()->getRowArray();
		if($huiyuanzudata['tubiao']){
			$huiyuanzudata['tubiao'] = dr_thumb($huiyuanzudata['tubiao']);
		} else {
			$huiyuanzudata['tubiao'] = '';
		}
		
		$rt=[
		'code'=>'1',
		'msg'=>'会员组介绍',
		'data' => $huiyuanzudata,
		];
		$this->_json(1, 2, $rt);
	}
	// 会员组列表
	public function huiyuanzulist() {
		$quanid = (int)\Phpcmf\Service::L('input')->get('quanid');
		$listdata = \Phpcmf\Service::M()->table('1_quan_form_yonghuzu')->where('cid', $quanid)->where('leixing', 0)->where('kaiguan', 1)->getAll();
		$listdatas = [];
		foreach ($listdata as $i => $t) {
			$t['inputtime']=dr_date($t['inputtime'], 'Y-m-d');
		    $listdatas[$i] = $t;
		}
		$rt=[
		'code'=>'1',
		'msg'=>'会员组列表',
		'data' => $listdatas,
		];
		$this->_json(1, 2, $rt);
	}
	// 加入圈子会员组
	public function jiaruhuiyuanzu() {
		$quanid = (int)\Phpcmf\Service::L('input')->get('quanid');
		$huiyuanzuid = (int)\Phpcmf\Service::L('input')->get('huiyuanzuid');
		$fufei = \Phpcmf\Service::M()->db->table('1_quan_buy')->where('cid', $quanid)->where('uid', $this->uid)->get()->getRowArray();
		$cart = \Phpcmf\Service::M()->db->table('1_quan_cart')->where('cid', $quanid)->where('uid', $this->uid)->get()->getRowArray();
		$jiaru = \Phpcmf\Service::M()->db->table('1_quan_form_group')->where('quanid', $quanid)->where('uid', $this->uid)->get()->getRowArray();
		if($jiaru['youxiaoqi']==0){
			$skushijian=36500;
		} else {
			$skushijian=$jiaru['youxiaoqi'];
		}
		if(!$cart){
		    // 加入圈子记录
		    \Phpcmf\Service::M()->db->table('1_quan_cart')->insert(array(
			    'cid' => $quanid,
			    'uid' => $this->uid,
			    'read_name' => '',
			    'read_url' => '',
				'inputtime' => SYS_TIME,
			));
		    $rt=[
		    'code'=>1,
		    'msg'=>'您已加入圈子',
		    ];
		    return $this->_json(0, 0, $rt);
		}
		// 不存在用户组，就添加用户组
		if(!$jiaru){
			\Phpcmf\Service::M()->db->table('1_quan_form_group')->insert(array(
			    'quanid' => $quanid,
			    'uid' => $this->uid,
				'gid' => $huiyuanzuid,
				'stime' => SYS_TIME,
				'etime' => SYS_TIME + 300,
			));
		} 
		// 存在用户组 就修改用户组
		if($jiaru){
			\Phpcmf\Service::M()->db->table('1_quan_form_group')->where('uid', $this->uid)->where('quanid', $quanid)->update(array(
				'gid' => $huiyuanzuid,
				'etime' => SYS_TIME + 3600 * 24 * $skushijian,
			));
		}
		$rt=[
		'code'=>'1',
		'msg'=>'加入成功',
		];
		$this->_json(1, 2, $rt);
	}
	
	public function zhifu() {
		$id = (int)\Phpcmf\Service::L('input')->get('id');
		$table = '1_quan_form_yonghuzu';
		$sku = \Phpcmf\Service::M()->db->table($table)->where('id',$id)->get()->getRowArray();
		
		//$url = PAY_URL.'index.php?s=pay&c=home&m=ajax&id='.$id.'&yonghupay=1';
		/*$url = ihttp_request(
		    PAY_URL.'index.php?s=pay&c=home&m=ajax&id='.$id.'&yonghupay=1'
		);*/
		//$skus = dr_string2array($sku);
		$datajiage = dr_payform('my-quan_huiyuanzu-'.$id);
		if($sku){
			$rt=[
				'code'=>1,
			    'msg'=>'支付页面',
				'data'=>$datajiage
			];
		}
		
		return $this->_json($rt['code'], $rt['msg'], $rt['data']);
	}
	public function mianfei() {
		$id = (int)\Phpcmf\Service::L('input')->get('id');
		$table = '1_quan_form_yonghuzu';
		$sku = \Phpcmf\Service::M()->db->table($table)->where('id',$id)->get()->getRowArray();
		if($sku['youxiaoqi']==0){
			$skushijian=36500;
		} else {
			$skushijian=$sku['youxiaoqi'];
		}
		$cart = \Phpcmf\Service::M()->db->table('1_quan_cart')->where('cid', $sku['cid'])->where('uid', $this->uid)->get()->getRowArray();
		$jiaru = \Phpcmf\Service::M()->db->table('1_quan_form_group')->where('quanid', $sku['cid'])->where('uid', $this->uid)->get()->getRowArray();
		if(!$cart){
		    // 加入圈子记录
		    \Phpcmf\Service::M()->db->table('1_quan_cart')->insert(array(
			    'cid' => $sku['cid'],
			    'uid' => $this->uid,
			    'read_name' => '',
			    'read_url' => '',
				'inputtime' => SYS_TIME,
			));
		    $rt=[
		    'code'=>1,
		    'msg'=>'您已加入圈子',
		    ];
		    return $this->_json(0, 0, $rt);
		}
		// 不存在用户组，就添加用户组
		if(!$jiaru){
			\Phpcmf\Service::M()->db->table('1_quan_form_group')->insert(array(
			    'quanid' => $sku['cid'],
			    'uid' => $this->uid,
				'gid' => $id,
				'stime' => SYS_TIME,
				'etime' => SYS_TIME + 3600 * 24 * $sku['youxiaoqi'],
			));
		} else {
		    \Phpcmf\Service::M()->db->table('1_quan_form_group')->where('uid', $this->uid)->where('quanid', $sku['cid'])->update(array(
			    
				'etime' => SYS_TIME + 3600 * 24 * $skushijian,
			));
		}
		if($sku){
			$rt=[
				'code'=>1,
			    'msg'=>'加入成功',
				'data'=>''
			];
		}
		return $this->_json($rt['code'], $rt['msg'], $rt['data']);
	}
	// 积分加入
	public function jifen() {
		$id = (int)\Phpcmf\Service::L('input')->get('id');
		$table = '1_quan_form_yonghuzu';
		$sku = \Phpcmf\Service::M()->db->table($table)->where('id',$id)->get()->getRowArray();
		$cart = \Phpcmf\Service::M()->db->table('1_quan_cart')->where('cid', $sku['cid'])->where('uid', $this->uid)->get()->getRowArray();
		$jiaru = \Phpcmf\Service::M()->db->table('1_quan_form_group')->where('quanid', $sku['cid'])->where('uid', $this->uid)->get()->getRowArray();
		$shengyujifen = $this->member['score'] - (int)$sku['jifen'];
		if($shengyujifen > 0 && $this->member['score'] > $shengyujifen){
			
		} else {
			$rt=[
			'code'=>0,
			'msg'=>'您的积分不够啦',
			'data'=>'',
			];
			return $this->_json(0, $rt['msg'], $rt['data']);
		}
		
		if(!$cart){
		    // 加入圈子记录
		    \Phpcmf\Service::M()->db->table('1_quan_cart')->insert(array(
			    'cid' => $sku['cid'],
			    'uid' => $this->uid,
			    'read_name' => '',
			    'read_url' => '',
				'inputtime' => SYS_TIME,
			));
		    $rt=[
		    'code'=>1,
		    'msg'=>'您已加入圈子',
			'data'=>$url
		    ];
		    //$this->_json($rt['code'], $rt['msg'], $rt['data']);
		}
		// 不存在用户组，就添加用户组
		if(!$jiaru){
			\Phpcmf\Service::M('member')->add_score($this->uid, -(int)$sku['jifen'], $note = '积分购买会员组', $url = '', $mark = '', $count = 0);
			\Phpcmf\Service::M('member')->add_score($sku['uid'], (int)$sku['jifen'], $note = '购买会员组获取积分', $url = '', $mark = '', $count = 0);
			\Phpcmf\Service::M()->db->table('1_quan_form_group')->insert(array(
			    'quanid' => $sku['cid'],
			    'uid' => $this->uid,
				'gid' => $id,
				'stime' => SYS_TIME,
				'etime' => SYS_TIME + 3600 * 24 * $sku['youxiaoqi'],
			));
		} else {
			\Phpcmf\Service::M('member')->add_score($this->uid, -(int)$sku['jifen'], $note = '积分购买会员组', $url = '', $mark = '', $count = 0);
			\Phpcmf\Service::M('member')->add_score($sku['uid'], (int)$sku['jifen'], $note = '购买会员组获取积分', $url = '', $mark = '', $count = 0);
			\Phpcmf\Service::M()->db->table('1_quan_form_group')->where('uid', $this->uid)->where('quanid', $sku['cid'])->update(array(
				'gid' => $sku['id'],
				'etime' => SYS_TIME + 3600 * 24 * $sku['youxiaoqi'],
			));
		}
		if($sku){
			
			$url = "index.php?s=quan&c=show&id=".$sku['cid'];
			$rt=[
				'code'=>1,
			    'msg'=>'加入成功',
				'data'=>$url
			];
			
			return $this->_json($rt['code'], $rt['msg'], $rt['data']);
		}
		
	}
	// 经验加入
	public function jingyan() {
		$id = (int)\Phpcmf\Service::L('input')->get('id');
		$table = '1_quan_form_yonghuzu';
		$sku = \Phpcmf\Service::M()->db->table($table)->where('id',$id)->get()->getRowArray();
		$cart = \Phpcmf\Service::M()->db->table('1_quan_cart')->where('cid', $sku['cid'])->where('uid', $this->uid)->get()->getRowArray();
		$jiaru = \Phpcmf\Service::M()->db->table('1_quan_form_group')->where('quanid', $sku['cid'])->where('uid', $this->uid)->get()->getRowArray();
		$shengyujingyan = (int)$sku['jingyan'];
		if($this->member['experience'] > $shengyujingyan){
			
		} else {
			$rt=[
			'code'=>0,
			'msg'=>'您的经验值不够啦',
			'data'=>'',
			];
			return $this->_json(0, $rt['msg'], $rt['data']);
		}
		
		if(!$cart){
		    // 加入圈子记录
		    \Phpcmf\Service::M()->db->table('1_quan_cart')->insert(array(
			    'cid' => $sku['cid'],
			    'uid' => $this->uid,
			    'read_name' => '',
			    'read_url' => '',
				'inputtime' => SYS_TIME,
			));
		    $rt=[
		    'code'=>1,
		    'msg'=>'您已加入圈子',
			'data'=>$url
		    ];
		    //$this->_json($rt['code'], $rt['msg'], $rt['data']);
		}
		// 不存在用户组，就添加用户组
		if(!$jiaru){
			
			\Phpcmf\Service::M()->db->table('1_quan_form_group')->insert(array(
			    'quanid' => $sku['cid'],
			    'uid' => $this->uid,
				'gid' => $id,
				'stime' => SYS_TIME,
				'etime' => SYS_TIME + 3600 * 24 * $sku['youxiaoqi'],
			));
		} else {
			
			\Phpcmf\Service::M()->db->table('1_quan_form_group')->where('uid', $this->uid)->where('quanid', $sku['cid'])->update(array(
				'gid' => $sku['id'],
				'etime' => SYS_TIME + 3600 * 24 * $sku['youxiaoqi'],
			));
		}
		if($sku){
			
			$url = "index.php?s=quan&c=show&id=".$sku['cid'];
			$rt=[
				'code'=>1,
			    'msg'=>'加入成功',
				'data'=>$url
			];
			
			return $this->_json($rt['code'], $rt['msg'], $rt['data']);
		}
		
	}
	// 邀请码
	public function similist() {
		$id = (int)\Phpcmf\Service::L('input')->get('cid');
		$datauid = \Phpcmf\Service::M()->db->table('1_quan')->where('id', $id)->where('uid', $this->uid)->get()->getRowArray();
		if (!$id) {
		    $this->_msg(0, '圈子ID不能为空');
		}
		if(!$datauid){
			$this->_msg(0, '没有这个圈子');
		}
		if ($datauid || $this->member['is_admin']) {
		    //$this->_msg(0, '圈子ID不能为空');
			
		} else {
			$this->_msg(0, '您不是圈子管理员');
		}
		//, ['url' => dr_url(APP_DIR.'/'.$this->router->class.'/index')]
		$table = SITE_ID.'_app_kami';
		if (IS_AJAX) {
			if($this->member['is_admin'] || $this->uid == $datauid['uid']){

				$data = \Phpcmf\Service::L('input')->post('data');
				$post = \Phpcmf\Service::L('input')->post('post');
				$data['endtime'] = strtotime($data['endtime']);
				$data['okgroup'] = dr_array2string($data['okgroup']);
				for ($i = 0; $i < $post['num']; $i++) { //添加数量
					$data['kami'] = \Phpcmf\Service::M('my', kami)->randomkeys($post['length']);
					$inmysql = \Phpcmf\Service::M()->db->table($table)->insert($data);
				}
				if($inmysql) {
					$this->_json(1, '已成功生成'.$post['num'].'张卡密', ['url' => dr_url(APP_DIR.'/'.$this->router->class.'/index')]);
				} else {
					$this->_json(0, '生成卡密失败，请重试！', ['url' => dr_url(APP_DIR.'/'.$this->router->class.'/index')]);
				}
			} else {
				$this->_json(0, '无权生成密钥！', ['url' => dr_url(APP_DIR.'/'.$this->router->class.'/index')]);
			}
		
		} else {
			//1_quan_form_yonghuzu
			$grouplist = '';
			$data = \Phpcmf\Service::M()->table('1_quan_form_yonghuzu')->where('cid', $id)->getAll();
			
			$value = dr_string2array($value);
			$v =1;
			foreach ($data as $v => $n) {
				$Value = $v + 1;
				$s = is_array($value) && in_array($v, $value) ? ' checked' : '';
				$kj = '<input type="checkbox"  class="form-control" name="data[okgroup]['.$title.']" value="'.$n['id'].'" '.$s.' '.$attr.' />';
				$grouplist.= '<label class="mt-checkbox mt-checkbox-outline">'.$kj.''.$n['title'].' <span></span> </label>&nbsp;&nbsp;';
			}
			
			\Phpcmf\Service::V()->assign([
				'grouplist'=> $grouplist,
				'groupdata' => $data,
			]);
			\Phpcmf\Service::V()->display("simi.html");
		}
			
	}
	public function simiindex() {
	    $this->_List();
		\Phpcmf\Service::V()->display('simi-index.html');
	}
	//私密加入
	public function simijiaru() {
		$id = (int)\Phpcmf\Service::L('input')->get('id');
		$cart = \Phpcmf\Service::M()->db->table('1_quan_cart')->where('cid', $id)->where('uid', $this->uid)->get()->getRowArray();
		$table = '1_quan_form_yonghuzu';
		$sku = \Phpcmf\Service::M()->db->table($table)->where('id',$id)->get()->getRowArray();
		if(!$cart){
		    // 加入圈子记录
		    \Phpcmf\Service::M()->db->table('1_quan_cart')->insert(array(
			    'cid' => $sku['cid'],
			    'uid' => $this->uid,
			    'read_name' => '',
			    'read_url' => '',
				'inputtime' => SYS_TIME,
			));
		    $rt=[
		    'code'=>1,
		    'msg'=>'您已加入圈子',
			'data'=>$url
		    ];
		    $this->_json($rt['code'], $rt['msg'], $rt['data']);
		}
		$rt=[
			'code'=>1,
		    'msg'=>'加入成功',
			'data'=>$url
		];
		return $this->_json($rt['code'], $rt['msg'], $rt['data']);
	}

	public function del() {
		$this->_Member_Del();
	}

}
